// pages/register/register.js
import {reqLogout} from '../../api/service'
Page({

  /**
   * 页面的初始数据
   */
  data: {
      value:'',
      userInfo:''
  },

  /**
   * 生命周期函数--监听页面加载
   */
  onLoad(options) {
    let userInfo = wx.getStorageSync('name')
    this.setData({
      userInfo:userInfo
    })


  },
  async logout(){
      try {
          const res = await reqLogout()
          wx.removeStorageSync('token')
          
          if(res.code===200 ){
            wx.showToast({
              title:'推出登录成功',
              icon:'success'
            })
            wx.navigateTo({
              url:'../login/login'
            })
          }
      } catch (error) {
          console.log(error)
      }
  }
 
})